<template>
  <div class="repayment">
<div>

<el-form :inline="true" :model="formInline" class="demo-form-inline">
  <el-form-item label="企业名">
    <el-input v-model="formInline.enterprisename" placeholder="企业名"></el-input>
  </el-form-item>
  <el-form-item label="社会信用代码">
    <el-input v-model="formInline.code" placeholder="****">
      
    </el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="onSubmit">查询</el-button>
  </el-form-item>
</el-form>

</div>
<div style="height:500px">
  <el-table
    :data="tableData"
    border
    style="width: 120%">
  
    
    <el-table-column
      prop="asid"
      label="序号"
      width="50">
      
    </el-table-column>
    <el-table-column
      prop="enterprisename"
      label="企业名称"
      width="150">
      <template slot-scope="scope">
        <el-popover trigger="hover" placement="top">
          <p>姓名: {{ scope.row.enterprisename }}</p>
         
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.enterprisename }}</el-tag>
          </div>
        </el-popover>
      </template>
    </el-table-column>
    <el-table-column
      prop="code"
      label="社会信用代码"
      width="200">
    </el-table-column>
    <el-table-column
      prop="amountborrowed"
      label="借款金额"
      width="90">
    </el-table-column>
    <el-table-column
      prop="salesman"
      label="业务员"
      width="80">
    </el-table-column>
    <el-table-column
      prop="registrant"
      label="登记人"
      width="120">
    </el-table-column>
    <el-table-column
      prop="overterm"
      label="逾期期数"
      width="100">
    </el-table-column>
     <el-table-column
      prop="overdate"
      label="逾期天数"
      width="80">
    </el-table-column>
     <el-table-column
      prop="begindate"
      label="任务开始时间"
      width="110">
    </el-table-column>
     <!-- <el-table-column
      prop="premium"
      label="手续费"
      width="80">
    </el-table-column>
     <el-table-column
      prop="loan"
      label="放款方式"
      width="80">
    </el-table-column>
 <el-table-column
      prop="repaymentstatus"
      label="还款状态"
      width="100">
    </el-table-column> -->
    <el-table-column
      fixed="right"
      label="操作"
      width="150">
      <template slot-scope="scope">
   
        <el-button type="text" size="small" @click="handleClicks(scope.row)">查看合同</el-button>
       
        <el-button type="text" size="small" @click="handles(scope.row),outerVisible = true">业务登记</el-button>
      </template>
    </el-table-column>
  </el-table>
</div>

  <div class="block">
    
    <el-pagination 
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[3, 4, 5, 7]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalRecord">
    </el-pagination>
  </div>





  <el-dialog title="还款记录" :visible.sync="dialogTableVisible"  style="width: 100%;"  >
   <el-table
      :data="tableDatas"
      style="width: 100%">
      <el-table-column
        prop="regid"
        label="序号"
        width="50">
      </el-table-column>
      <el-table-column
        prop="repaymentdate"
        label="还款日期"
         value-format="yyyy-MM-dd"
        width="120">
      </el-table-column>
      <el-table-column
        prop="actualrepaymentdate"
        label="实际还款日期"
        width="120">
      </el-table-column>
      <el-table-column
        prop="shouldtotal"
        label="应还总额"
         width="100">
      </el-table-column>
      <el-table-column
        prop="shouldprincipal"
        label="应还本金">
      </el-table-column>
      <el-table-column
        prop="overdue"
        label="应还利息">
      </el-table-column>
      <el-table-column
        prop="rxpectedpenaltyrate"
        label="逾期天数">
      </el-table-column>
      <el-table-column
        prop="repaymentstatus"
        label="逾期罚息">
      </el-table-column>
      <el-table-column
        prop="state"
        label="还款状态">
      </el-table-column>
      
    </el-table>

     <el-pagination 
      @size-change="handleSizeChanges"
      @current-change="handleCurrentChanges"
      :current-page="currentPage5"
      :page-sizes="[3, 4, 5, 7]"
      :page-size="pageSizes"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalRecords">
    </el-pagination>
</el-dialog>






<el-dialog title="设置业务登记" :visible.sync="outerVisible">

    
     
  

    <el-form ref="form" :model="sizeFormss" label-width="80px" size="big" :rules="rules" >
  
    <el-form-item label="名称" prop="names">
    <el-input v-model="sizeFormss.names"></el-input>
  </el-form-item>
     <el-button @click="outerVisible = false">取 消</el-button>
      <el-button type="primary" @click="outerVisible = false,submitForm(sizeForm)">点击确认</el-button>
    </el-form>
  </el-dialog>
  
  </div>
</template>

<script>
export default {
  data () {
     
    return {
        adc:{},
      sizeFormss: {
        
         
          names:''
        
        },
        rules: {   
          
          names: [
            { required: true, message: '请输入名称', trigger: 'blur' },
            { min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur' }
          ],
         
        },
     
      outerVisible: false,
        innerVisible: false,
      pageSize:7,
      pageSizes:7,
      dialogTableVisible: false,
      totalRecord:this.totalRecord,
      totalRecords:this.totalRecords,
       currentPage4: 1,
       currentPage5: 1,
     tableData: [],
     tableDatas:[],
      formInline: {
          user: '',
          region: ''
        }
    }
  },
  created(){
      this.init()
  },

  methods:{
    sizeForm(){},
    handles(row){
 console.log("row的ID--"+row.asid)
  this.abc=row
  console.log("this.abc--"+this.abc.code)
    },
    submitForm(){
      
      console.log("---this.sizeForm.reid"+this.abc.asid)

       console.log("---this.sizeForm.date1----"+this.sizeFormss.names)
      
    this.$axios
        .get("http://localhost:8082/AssetPreservation/updateByname", {
          params: {
           names:this.sizeFormss.names,
            asid:this.abc.asid
          }
        })
        


    },
    handleClickssss(row){
        console.log("进入收费")
      this.$axios.get("http://localhost:8082/RepaymentRegistered/RepaymentRegisteredSelectall",{params:{
           reid:row.reid,
           pageIndex:this.currentPage4,
            pageSize: this.pageSize
      }}).then(resp=>{
      this.tableDatas = resp.data.data.beanList;
      this.totalRecords=resp.data.data.totalRecord;
      });
    console.log(row);
    },
     onSubmit() {
        console.log('submit!');
        this.$axios.get("http://localhost:8082/AssetPreservation/selcetByname", 
        {params: {
            enterprisename:this.formInline.enterprisename,
            code:this.formInline.code
        }}).then(resp=>{
           this.tableData=resp.data.data
          console.log(resp)
        })
      },
     handleSizeChange(val) {
       this.pageSize=val
        console.log(`每页 ${val} 条`);
         this.init();
      },
      handleSizeChanges(val){
        this.pageSizes=val
        console.log(`每页 ${val} 条`);
         this.inits();
      },
      handleCurrentChange(val) {
          this.currentPage=val
        console.log(`当前页: ${val}`);
        this.init();
      },
      handleCurrentChanges(val){
          this.currentPage5=val
        console.log(`当前页: ${val}`);
        this.inits();
      },
    handleClicks(row) {
      this.$router.push({path:'/infoss',query:{reid:row.reid}});
        console.log(row);
      },
    init(){
      this.$axios
        .get("http://localhost:8082/AssetPreservation/repaymentAll", {
          params: {
            
            pageIndex:this.currentPage4,
            pageSize: this.pageSize
          }
        })
        .then(resp => {
          this.tableData = resp.data.data.beanList;
          this.totalRecord=resp.data.data.totalRecord;
          console.log(resp)
        });
    },
    inits(){
      console.log()
     
     
    }
  }
}
</script>

<style >
.block{
 position: relative;
 left: 350px;
 top: 10px;


}
.demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 20%;
  }

</style>